package org.example.domain.po;

import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import java.util.List;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * 功能模块表
 * @TableName erp_menu
 */
@TableName(value ="erp_menu")
@Data
@ApiModel(description = "菜单")
public class ErpMenu implements Serializable {
    /**
     * 主键
     */
    @ApiModelProperty("主键")
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 中文名称
     */
    @ApiModelProperty("中文名称")
    private String cname;

    /**
     * 英文名称
     */
    @ApiModelProperty("英文名称")
    private String ename;

    /**
     * 路由路径
     */
    @ApiModelProperty("路由路径")
    private String path;

    /**
     * 组件名称
     */
    @ApiModelProperty("组件名称")
    private String component;

    /**
     * 请求路径
     */
    @ApiModelProperty("请求路径")
    private String url;

    /**
     * 类型：M是菜单F是功能
     */
    @ApiModelProperty("类型：M是菜单F是功能")
    private String type;

    /**
     * 权限标识
     */
    @ApiModelProperty("权限标识")
    private String perm;

    /**
     * 父级编号
     */
    @ApiModelProperty("父级编号")
    private Integer parentid;

    /**
     * 父级名称
     */
    @ApiModelProperty("父级名称")
    private String parentname;
    
    @ApiModelProperty("权限按钮")
    private String pushBtn;

    /**
     * 图标
     */
    @ApiModelProperty("图标")
    private String icon;

    /**
     * 删除标记，0未删除，1删除
     */
    @ApiModelProperty("删除标记，0未删除，1删除")
    @TableLogic
    private String deleteFlag;
    
    /**
     * 是否授权菜单时新增
     */
    private boolean initialAdd;
    
    @TableField(exist = false)
    private List<ErpMenu> children;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        ErpMenu other = (ErpMenu) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getCname() == null ? other.getCname() == null : this.getCname().equals(other.getCname()))
            && (this.getEname() == null ? other.getEname() == null : this.getEname().equals(other.getEname()))
            && (this.getPath() == null ? other.getPath() == null : this.getPath().equals(other.getPath()))
            && (this.getComponent() == null ? other.getComponent() == null : this.getComponent().equals(other.getComponent()))
            && (this.getUrl() == null ? other.getUrl() == null : this.getUrl().equals(other.getUrl()))
            && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
            && (this.getPerm() == null ? other.getPerm() == null : this.getPerm().equals(other.getPerm()))
            && (this.getParentid() == null ? other.getParentid() == null : this.getParentid().equals(other.getParentid()))
            && (this.getParentname() == null ? other.getParentname() == null : this.getParentname().equals(other.getParentname()))
            && (this.getIcon() == null ? other.getIcon() == null : this.getIcon().equals(other.getIcon()))
            && (this.getDeleteFlag() == null ? other.getDeleteFlag() == null : this.getDeleteFlag().equals(other.getDeleteFlag()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getCname() == null) ? 0 : getCname().hashCode());
        result = prime * result + ((getEname() == null) ? 0 : getEname().hashCode());
        result = prime * result + ((getPath() == null) ? 0 : getPath().hashCode());
        result = prime * result + ((getComponent() == null) ? 0 : getComponent().hashCode());
        result = prime * result + ((getUrl() == null) ? 0 : getUrl().hashCode());
        result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
        result = prime * result + ((getPerm() == null) ? 0 : getPerm().hashCode());
        result = prime * result + ((getParentid() == null) ? 0 : getParentid().hashCode());
        result = prime * result + ((getParentname() == null) ? 0 : getParentname().hashCode());
        result = prime * result + ((getIcon() == null) ? 0 : getIcon().hashCode());
        result = prime * result + ((getDeleteFlag() == null) ? 0 : getDeleteFlag().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", cname=").append(cname);
        sb.append(", ename=").append(ename);
        sb.append(", path=").append(path);
        sb.append(", component=").append(component);
        sb.append(", url=").append(url);
        sb.append(", type=").append(type);
        sb.append(", perm=").append(perm);
        sb.append(", parentid=").append(parentid);
        sb.append(", parentname=").append(parentname);
        sb.append(", icon=").append(icon);
        sb.append(", deleteFlag=").append(deleteFlag);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}